<template>
	<view class="detail-page page">
		<view class="content-block">
			<view class="title">{{title}}</view>
			<view class="sub-title">发布时间：{{time}}</view>
			<view class="article-content">
				<template v-if="id">
					<image @click="preview(item)" mode="widthFix" class="content-image" v-for="(item,index) in content" :src="item" :key="index"></image>
				</template>
			</view>
		</view>
	</view>
</template>

<script>
	import {getStatistics,getNewsList,getNewListDetail} from '@/api/api.js';
	export default {
		data() {
			return {
				id:null,
				title:'',
				time:'',
				type:'',
				info:{},
				detail:{
					1:['http://rsj.jiuquan.gov.cn/rsj/c106799/202306/2bbb27fc5e454036a2d31e620abf2a3c/images/W020230613356590790885.png'],
					2:['https://job-1306862033.cos.ap-chengdu.myqcloud.com/miniprogram-static/home/news2.png'],
					3:['https://job-1306862033.cos.ap-chengdu.myqcloud.com/miniprogram-static/home/news3.png'],
					4:['https://job-1306862033.cos.ap-chengdu.myqcloud.com/miniprogram-static/home/news4.png'],
					5:['https://job-1306862033.cos.ap-chengdu.myqcloud.com/miniprogram-static/home/news5.png'],
					6:['https://job-1306862033.cos.ap-chengdu.myqcloud.com/miniprogram-static/home/news6.png'],
					7:['https://job-1306862033.cos.ap-chengdu.myqcloud.com/miniprogram-static/home/news7.png'],
					8:['https://job-1306862033.cos.ap-chengdu.myqcloud.com/miniprogram-static/home/news8.png'],
					9:['https://job-1306862033.cos.ap-chengdu.myqcloud.com/miniprogram-static/home/news9.png'],
					10:['https://job-1306862033.cos.ap-chengdu.myqcloud.com/miniprogram-static/home/news10.png'],
					11:['https://job-1306862033.cos.ap-chengdu.myqcloud.com/miniprogram-static/home/news11.png'],
					12:['https://job-1306862033.cos.ap-chengdu.myqcloud.com/miniprogram-static/home/news12.png'],
					13:['https://job-1306862033.cos.ap-chengdu.myqcloud.com/miniprogram-static/home/news13.png'],
					14:['https://job-1306862033.cos.ap-chengdu.myqcloud.com/miniprogram-static/home/news14.png'],
					15:['https://job-1306862033.cos.ap-chengdu.myqcloud.com/miniprogram-static/home/news15.png'],
				},
				content:[],
			}
		},
		methods:{
			preview(item){
				uni.previewImage({
					current:item,
					urls:this.content
				})
			},
			
			getListDetail() {
				uni.showLoading({
					title: '加载中',
					mask: true
				})
				getNewListDetail({
					id: this.id
				}).then(data => {
					uni.hideLoading()
					this.info = data
				}).catch(() => {
					uni.hideLoading()
				})
			},
		},
		onLoad(e) {
			this.id=e.id
			this.content=this.detail[this.id];
			this.title=e.title;
			this.time=e.time;
			this.getListDetail()
		}
	}
</script>

<style lang="scss" scoped>
	.detail-page {
		width: 100%;
		padding-bottom: 20rpx;
	
		.content-block {
			background-color: #fff;
			padding: 30rpx;
	
			.title {
				font-size: 40rpx;
				font-weight: bold;
				margin-bottom: 30rpx;
			}
	
			.sub-title {
				font-size: 28rpx;
				color: #999;
				margin-bottom: 30rpx;
			}
			.article-content{
				width: 100%;
				.content-image{
					width: 100%;
					margin: 0 auto;
				}
			}
		}	
	}
</style>
